package com.mcintyret.site.journal.database;

import com.mcintyret.site.journal.JournalFamily;
import org.springframework.stereotype.Repository;

/**
 * User: mcintyret2
 * Date: 16/04/2012
 */

@Repository
public class JournalFamilyDao extends AbstractJournalDao<JournalFamily> {

    public JournalFamilyDao() {
        super(JournalFamily.class);
    }

    public int getNumberOfJournalFamilies() {
        String query = "select count(*) from JournalFamily where username = '" + userContext.getUsername() + "'";
        return ((Long) sessionFactory.getCurrentSession().createQuery(query).uniqueResult()).intValue();
    }
}
